package com.sup.model;

import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.sup.common.BaseModel;
@Entity
@Table(name="customer")
@Cacheable
@Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL,include="non-lazy")
public class Customer extends BaseModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	
	private Long number;
	private String name;
	
	private String sex;
	
	private int age;
	
	private String phone;
	
	private String address;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getNumber() {
		return number;
	}

	public void setNumber(Long number) {
		this.number = number;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public boolean compareTo(Customer customer) {
		if(this.number!=customer.getNumber()){
			return true;
		}
		if(!this.name.equals(customer.getName())){
			return true;
		}
		if(!this.phone.equals(customer.getPhone())){
			return true;
		}
		if(!this.address.equals(customer.getAddress())){
			return true;
		}
		return false;
	}
	
	

}
